﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using LinFu.IoC;
using LinFu.IoC.Configuration;
using LinFu.IoC.Configuration;
using LinFu.IoC.Configuration.Interfaces;
using LinFu.IoC.Interfaces;
using NUnit.Framework;

namespace CoreEx.MicroMapper.Tests
{
    public abstract class BaseFixture
    {
        protected IServiceContainer _serviceContainer;

        [SetUp]
        public virtual void Setup()
        {
            _serviceContainer = new ServiceContainer();            
            var directory = AppDomain.CurrentDomain.BaseDirectory;
            Loader loader = new Loader();            
            loader.LoadDirectory(directory, "*.dll");            
            loader.LoadInto(_serviceContainer);
            
            _serviceContainer.SetCustomPropertyInjectionAttribute(typeof(InjectAttribute));
            _serviceContainer.SetCustomMethodInjectionAttribute(typeof(InjectAttribute));
            _serviceContainer.SetCustomFieldInjectionAttribute(typeof(InjectAttribute));
            
        }
        [TearDown]
        public virtual void TearDown()
        {
            _serviceContainer = null;
        }
    }
}